#!/usr/bin/perl -w
# This software is licensed under the MIT License.
# 
# Copyright (c) 2009 Andrey Serebryakov

package MT::Plugin::RamblerID;

use MT;
use strict;
use base qw( MT::Plugin );
our $VERSION = '1.1';

require MT::Auth::Rambler;

my $plugin = MT::Plugin::RamblerID->new({
	key         => 'RamblerID',
	id          => 'RamblerID',
	name        => 'Рамблер.OpenID',
	description => "Авторизация комментаторов через Рамблер OpenID.",
	version     => $VERSION,
	author_name => "Andrey Serebryakov",
	author_link => "http://blogstudio.ru/",
	plugin_link => "http://code.google.com/p/mt-plugins/wiki/RamblerOpenID",
});

sub instance { $plugin; }

MT->add_plugin($plugin);

sub init_registry {
	my $plugin = shift;
	$plugin->registry({
		commenter_authenticators => {
			'Rambler' => {
				class => 'MT::Auth::Rambler',
				label => 'Rambler',
				login_form_params => '$RamblerID::MT::Auth::Rambler::commenter_auth_params',
				condition => '$RamblerID::MT::Auth::Rambler::openid_commenter_condition',
				logo => 'plugins/RamblerID/images/rambler.png',
				logo_small => 'plugins/RamblerID/images/rambler_logo.gif',
				login_form => <<RAMBLER,
<form method="post" action="<mt:var name="script_url">">
<input type="hidden" name="__mode" value="login_external" />
<input type="hidden" name="openid_url" value="rambler.ru" />
<input type="hidden" name="blog_id" value="<mt:var name="blog_id">" />
<input type="hidden" name="entry_id" value="<mt:var name="entry_id">" />
<input type="hidden" name="static" value="<mt:var name="static" escape="html">" />
<input type="hidden" name="key" value="Rambler" />
<fieldset>
<mtapp:setting
	id="rambler_display"
	show_label="0">
</mtapp:setting>
<div class="pkg">
	<p class="left">
		<input src="<mt:var name="static_uri">plugins/RamblerID/images/rambler_logo.gif" type="image" name="submit" value="Авторизация" />
	</p>
</div>
<p><img src="<mt:var name="static_uri">images/comment/blue_moreinfo.png" /> <a href="http://help.rambler.ru/article.html?s=25678&id=46182">Узнать больше о Рамблер.OpenID.</a> </p>
</fieldset>
</form>
RAMBLER
            },
        },
    });
}

1;
__END__

